<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue CSS 动画</title>
    <script src="./vue.js"></script>
    <style>
        /*淡入淡出效果*/
        /*.fade-enter{*/
        /*opacity: 0;*/
        /*}*/
        /*.fade-enter-active{*/
        /*transition: opacity 2s;*/
        /*}*/

        .v-enter,
        .v-leave-to {
            opacity: 0;
        }

        .v-enter-active,
        .v-leave-active {
            transition: opacity 1s;
        }
    </style>
</head>
<body>
<div id="app">
    <!--name 指定样式名称的前缀，默认为v-->
    <!--<transition name="fade">-->
    <transition>
        <div v-if="show">v-if</div>
        <div v-show="show">v-show</div>
        <!--动态组件-->
    </transition>
    <button @click="handleClick">toggle</button>
</div>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            show: true
        },
        methods: {
            handleClick: function () {
                this.show = !this.show
            }
        }
    });
</script>
</body>
</html>